<!DOCTYPE html>
<html>
<head> 
    <meta charset=utf-8>
    <meta http-equiv="X-UA-Compatible" content="IE=9">
    <title>YuJian你的世界</title>
    <link rel='stylesheet' href='<?php echo Asset::get_file('layui/css/layui.css','plugin'); ?>'>
    <script type='text/javascript' src='<?php echo Asset::get_file('layui/layui.js','plugin'); ?>'></script>
    <script type='text/javascript' src='<?php echo Asset::get_file('jquery-1.8.2.min.js','js'); ?>'></script>
    <script type='text/javascript' src='<?php echo Asset::get_file('home/cscms.js','js'); ?>'></script>
    <meta name="Keywords" content="YuJian你的世界" />
    <meta name="Description" content="YuJian你的世界" />
    <link rel="shortcut icon" href="/favicon.ico" />
    <link rel="stylesheet" href="<?php echo Asset::get_file('home/font.css','fonts'); ?>">
    <link rel="stylesheet" type="text/css" href="<?php echo Asset::get_file('home/index.css','css'); ?>"/>
    <link rel="stylesheet" type="text/css" href="<?php echo Asset::get_file('home/swiper.css','css'); ?>"/>
    <script type='text/javascript' src='<?php echo Asset::get_file('home/swiper.js','js'); ?>'></script>
    <style>
        .custom_lable{
            margin-left: 10px;
            display: inline-block;
            width: 90px;
            padding: 8px 8px 8px 8px;
            border: 1px solid #e6e6e6;
            border-radius: 2px 0 0 2px;
            text-align: center;
            background-color: transparent;
            opacity: 0.8;
            text-overflow: ellipsis;
            box-sizing: border-box!important;
            cursor:pointer;
        }
        .logo{
            width: 60px;
        }
        .title{
            width: 1017px;
            text-align: center;
            margin: auto;
        }
        .custom-upload-div{
            width: 190px;
            text-align:center;
            border-style: solid;
            border-color: #00c091;
            /*background-image: url('src/005BjCpA1_small.jpg');*/
        }
        .layui-custom-quote{
            padding:0;
            margin-bottom:0;
            border-color:transparent;
        }
        .layui-custom-table{
            table-layout: auto!important;
            background-color: #393d49;;
            width: 900px;
            opacity: 0.85;
        }
        .layui-custom-div-quot{
            border-style: groove;
            border-color: #00c091;
            float: inherit;
        }
        .layui-quot-custom-p1{
            color: #4affff
        }
        .layui-quot-custom-p2{
            color: #ff0000
        }
        .custom-left{
            float: left;
            height: 100%;
            width: 512px;
        }
        .custom-right{
            height: 100%;width: 512px;float: right;
        }
        .custom-content{
            background-color:#1d3651;
            width: 920px;
            height: 100%;
            margin-left:325px;
            text-align: -webkit-center;
            z-index: 1000;
            position: absolute;
            border: 1px;
            border-color: #4affff;
            border-bottom-color: transparent;
            border-style: groove;
            opacity: 0.9;
        }
        .custom-left-right-img{
            width: 100%;
        }
        .layui-btn-primary {
            background-color: transparent;
    </style>
</head>
<body >
<style type="text/css">html,body{height: 100%;background-color: #0C0C0C}</style>
<div style="height: 280px;background-color: #000000">
    <div class="title">
        <img style='height: 100%;text-align: center;margin: auto' src="<?php echo Asset::get_file('home/background_home_2.jpg','img'); ?>" alt="" style="height: 250px;">
    </div>
</div>
<div class="header">
    <div class="w960" >
        <a class="logo" href="#" title="YuJian你的世界"></a>
        <ul class="layui-nav" lay-filter="">
            <li class="layui-nav-item"><a href="<?php echo Uri::create('home/index'); ?>">首页</a></li>
            <?php
            $class_arr = array(
                'film'      => ' ',
                'tv'        => ' ',
                'variety'   => ' ',
                'anime'     => ' '
            );
            $class_arr[$current_type] .= 'layui-this';
            ?>
            <li class="layui-nav-item<?php echo $class_arr['film']; ?>">
                <a href="<?php echo Uri::create('home/movie'),'/film'; ?>">电影</a>
            </li>

            <li class="layui-nav-item<?php echo $class_arr['tv']; ?>">
                <a href="<?php echo Uri::create('home/movie'),'/tv'; ?>">电视剧</a>
            </li>

            <li class="layui-nav-item<?php echo $class_arr['variety']; ?>">
                <a href="<?php echo Uri::create('home/movie'),'/variety'; ?>">综艺</a>
            </li>

            <li class="layui-nav-item<?php echo $class_arr['anime']; ?>">
                <a href="<?php echo Uri::create('home/movie'),'/anime'; ?>">动漫</a>
            </li>

        </ul>
    </div>
</div>
<div class="custom-left">
    <img class="custom-left-right-img" src="<?php echo Asset::get_file('home/background_left.jpg','img'); ?>" alt="">
</div>
<div class="custom-right">
    <img class="custom-left-right-img" src="<?php echo Asset::get_file('home/background_right.jpg', 'img'); ?>" alt="">
</div>
<div class="custom-content" id="dataContent">
    <table class="layui-table layui-custom-table" >
        <colgroup>
            <col width="226">
            <col>
        </colgroup>
        <tbody id="dataBody">
        <tr>
            <td colspan="4"><p class="layui-quot-custom-p1">名字：<?php echo $current_obj->movie_name; ?></p></td>
        </tr>
        <tr>
            <td>
                <div class="custom-upload-div">
                    <img alt='<?php echo $current_obj->director_name; ?>' title='<?php echo $current_obj->director_name; ?>' src='<?php echo $current_obj->picture_src_path; ?>'/>
                </div>
            </td>
            <td>
                <table>
                    <colgroup>
                        <col width="100"/>
                        <col width=""/>
                    </colgroup>
                    <tbody>
                    <tr>
                        <td><p class="layui-quot-custom-p1">导演</p></td>
                        <td class="custom-td-input-edit"><p class="layui-quot-custom-p1"><?php echo $current_obj->director_name; ?></p></td>
                    </tr>
                    <tr>
                        <td><p class="layui-quot-custom-p1">主演</p></td>
                        <td class="custom-td-input-edit">
                            <p class="layui-quot-custom-p1"><?php echo $current_obj->actor_name; ?></p>
                        </td>
                    </tr>
                    <tr>
                        <td><p class="layui-quot-custom-p1">制片国家</p></td>
                        <td class="custom-td-input-edit">
                            <p class="layui-quot-custom-p1"><?php echo $current_obj->state_name; ?></p>
                        </td>
                    </tr>
                    <tr>
                        <td><p class="layui-quot-custom-p1">视频类型</p></td>
                        <td class="custom-td-input-edit">
                            <p class="layui-quot-custom-p1"><?php echo $current_obj->movie_type; ?></p>
                        </td>
                    </tr>
                    <tr>
                        <td><p class="layui-quot-custom-p1">上映日期</p></td>
                        <td class="custom-td-input-edit">
                            <p class="layui-quot-custom-p1"><?php echo $current_obj->update_time; ?></p>
                        </td>
                    </tr>
                    <tr>
                        <td><p class="layui-quot-custom-p1">评分</p></td>
                        <td class="custom-td-input-edit"><p class="layui-quot-custom-p1"><?php echo $current_obj->grade_num; ?></p></td>
                    </tr>
                    </tbody>
                </table>
            </td>
        </tr>
        <tr>
            <td colspan="2"><br/>
                <p class="layui-quot-custom-p1">
                    <?php echo $current_obj->movie_detail; ?>
                </p><br/>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <p class="layui-quot-custom-p1">资源：</p>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <?php
                if($current_obj->movie_sign)
                {
                    echo '<button type="button" class="layui-btn layui-btn-primary" onclick="startVideo()"><span class="layui-quot-custom-p1">',$current_obj->movie_sign,'</span></button>';
                }else{
                    echo '<br/>';
                }
                ?>

            </td>
        </tr>
        </tbody>
    </table>
</div>

<script>
    //数据URL
    var URL_GETDATA = "<?php echo Uri::create('manager/pagedata'); ?>";
    var URL_CURRENTDATA = "<?php echo $current_obj->movie_path; ?>";
    //layui加载
    layui.use(['jquery','layer','laypage'],function () {
        var $ = layui.jquery,
            layer = layui.layer,
            laypage = layui.laypage;
        var laypageId = 'pageNav';
        var typeName = {'film' : '电影列表', 'tv' : '电视剧列表', 'variety' : '综艺列表', 'anime' : '动漫列表'};
        var dataType = "<?php echo $current_type ?>";
        var i = 0;
        var data;
        //getData();
        //获取数据
        function getData() {
            $.post(URL_GETDATA, {type : 'page', movie_type : dataType}, function (res) {
                data = eval('(' + res + ')');
                //data = resultData['data'];
                initilData(1, 8);
            });
        }

        function initilData(currentIndex, pageSize) {
            var index = layer.load(1);
            setTimeout(function () {
                layer.close(index);

                var pages = Math.ceil(data.length / pageSize);
                //模拟数据分页（实际上获取的数据已经经过分页）
                var skip = pageSize * (currentIndex - 1);
                var take = skip + Number(pageSize);
                var handledata = data.slice(skip, take);

                var html = '';  //由于静态页面，所以只能作字符串拼接，实际使用一般是ajax请求服务器数据
                html += '<table class="layui-table layui-custom-table" ><tbody>';
                html += '<tr><td colspan="4"><p class="layui-quot-custom-p1">' + typeName[dataType] + '</p></td></tr>';
                var dataIndex = 0;
                //遍历文章集合
                for (var i = 0; i <= handledata.length / 4; i ++)
                {
                    html += '<tr>';
                    for (var j = i * 4; j < 4 * i + 4; j ++ )
                    {
                        if(dataIndex < handledata.length)
                        {
                            //console.log(handledata);
                            var item = handledata[dataIndex];
                            //console.log(item);
                            html += '<td class="layui-td-custom-data"><div class="custom-upload-div"><img alt="' + item['movie_name'] + '" title="' + item['movie_name'] + '" src="' + item['picture_src_path'] + '"/><div class="layui-custom-div-quot"><blockquote class="layui-elem-quote layui-quote-nm layui-custom-quote"><p class="layui-quot-custom-p1">' + item['movie_name'] + '</p><p class="layui-quot-custom-p2">' + item['update_time'] + '</p></blockquote></div></div></td>';
                            dataIndex ++;
                        }
                        else
                        {
                            html += '<td style="width: 226px;"></td>';
                        }

                    }
                    html += '</tr>';
                }
                html += '</tbody>';
                html += '</table>';
                html += '<div id="' + laypageId + '"></div>';
                $('#dataContent').html(html);

                //$('#dataConsole,#dataList').attr('style', 'display:block'); //显示FiledBox

                laypage({
                    cont: laypageId,
                    pages: pages,
                    groups: 8,
                    skip: true,
                    curr: currentIndex,
                    jump: function (obj, first) {
                        var currentIndex = obj.curr;
                        if (!first) {
                            initilData(currentIndex, pageSize);
                        }
                    }
                });
                //该模块是我定义的拓展laypage，增加设置页容量功能
                //laypageId:laypage对象的id同laypage({})里面的cont属性
                //pagesize当前页容量，用于显示当前页容量
                //callback用于设置pagesize确定按钮点击时的回掉函数，返回新的页容量
                pagesize(laypageId, pageSize).callback(function (newPageSize) {
                    //这里不能传当前页，因为改变页容量后，当前页很可能没有数据
                    initilData(1, newPageSize);
                });
            }, 500);
        }

        function pagesize(id, pageSize) {
            $('#' + id + ' .layui-laypage').append('<span class="laypage-extend-pagesize">&#x6bcf;&#x9875; <input type="number" min="4" onkeyup="inputCheck(this)" value="4" class="layui-laypage-skip" > &#x6761; <button type="button" class="layui-laypage-btn">&#x786e;&#x5b9a;</button></span>');
            $('#' + id + ' .laypage-extend-pagesize input[class=layui-laypage-skip]').val(pageSize);
            var pagesize = {
                btn: $('#' + id + ' .laypage-extend-pagesize .layui-laypage-btn'),
                callback: function (callback) {
                    this.ok = callback;
                },
                ok: null
            };
            $(pagesize.btn).on('click', function () {
                pagesize.ok(pagesize.btn.siblings('input[class=layui-laypage-skip]').val());
            });
            return pagesize;
        }
        //处理数据
    });
    function inputCheck(currentObj) {
        currentObj.value = currentObj.value.replace(/\D/, '');
        var currentNum = Math.ceil(currentObj.value);

        if(currentNum % 4 == 0){
            currentNum = currentNum;
        }else{
            //console.log((currentNum/ 4) + 1);
            currentNum = Math.floor( currentNum / 4 + 1 ) * 4;
        }
        currentObj.value = currentNum;
    }

    function startVideo() {
        var html = '<tr><td colspan="2"><video style="width: 860px;" src="' + URL_CURRENTDATA + '" controls="controls"></video></td></tr>';
        $('#dataBody').append(html);
    }
</script>
</body>
</html>